/*

Author   : chaos

FileName : class_convert.cpp

Date     : 14/08/17 20:26:17

*/
#include <iostream>
using namespace std;

class Base
{
    public:
        Base():pub_att(1){}
        int pub_att;

};


class Derived1:public Base
{
    public:
        Derived1():att(2){}
        int att;
};

class Derived2:private  Base
{
    public:
        Derived2():att(3){}
        int att;
};

void class_con(Base & A_Base)
{
    cout << "class_con is called" << endl;
    cout << "Base::pub_att = " << A_Base.pub_att << endl;
}

int main(int argc ,char *argv[])
{
    Derived1 A_Derived1;
    Derived2 A_Derived2;

    Base A_Base1 ,A_Base2;

    A_Base1 = A_Derived1;

    //A_Base2 = (Base) A_Derived2;

    Base * base_ptrl = &A_Derived1;

    Base * base_ptr2 = (Base *)&A_Derived2;

    class_con(A_Derived1);

    class_con((Base &)A_Derived2);
    return 0;
}
